package rwt.server.handlers.web;

import rwt.server.WebMessages.CloseSwitchRequest;
import rwt.server.core.*;
import rwt.server.railroad.Switches;

public class CloseSwitchHandler extends MessageHandler<CloseSwitchRequest>
{
	@Override
	public void handle(CloseSwitchRequest message, IConnection source) throws Exception
	{
		if (!(source instanceof IClient))
			throw new IllegalArgumentException("CloseSwitch did not come from a client.");
		
		IClient client = (IClient) source;
		Switches.getInstance().removeClientSwitches(client);
	}
}
